package com.zmc.member.controller;


import com.zmc.member.application.MyCollectionApplicationService;
import com.zmc.member.infrastructure.bean.query.MyCollectionQuery;
import com.zmc.member.infrastructure.bean.vo.MyCollectionVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.zmc.common.utils.R;



/**
 * 会员收藏的商品
 *
 * @author zmc
 * @email 
 * @date 2024-10-09 14:56:33
 */
@RestController
@RequestMapping("/collect")
public class MemberCollectController {


    @Autowired
    private MyCollectionApplicationService collectionApplicationService;

    /**
     * 列表
     */
    @PostMapping("/list")
    public R list(@RequestBody MyCollectionQuery query){
        return R.ok(collectionApplicationService.pageCollection(query));
    }


    /**
     * 保存
     */
    @PostMapping("/add")
    public R save(@RequestBody MyCollectionVo vo){
        collectionApplicationService.save(vo);
        return R.ok();
    }


    /**
     * 删除
     */
    @PostMapping("/delete")
    public R delete(@RequestBody MyCollectionVo vo){
        collectionApplicationService.remove(vo);
        return R.ok();
    }

}
